From: Andreas Beckmann Date: Fri, 19 Nov 2021 11:10:45 +0000 (+0100) Subject: [PATCH 58/90] run_test: show diff if test output does not match the expected output X-Git-Tag: archive/raspbian/1.8-3+rpi1^2~76 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=8e82688e9cab3efbde05f1671b1e9f634f6f2300;p=pocl.git [PATCH 58/90] run_test: show diff if test output does not match the expected output Gbp-Pq: Name 0058-run_test-show-diff-if-test-output-does-not-match-the.patch --- diff --git a/cmake/run_test.cmake b/cmake/run_test.cmake index 5ea265b..41f13bf 100644 --- a/cmake/run_test.cmake +++ b/cmake/run_test.cmake @@ -62,6 +62,16 @@ if(output_blessed) ) if( test_not_successful ) + find_program(DIFF "diff") + if(DIFF) + execute_process( + COMMAND "${DIFF}" "-d" "-u" "${output_blessed}" "${RANDOM_FILE}" + RESULT_VARIABLE test_not_successful + OUTPUT_VARIABLE stdout + ERROR_VARIABLE stderr + ) + message("${stdout}\n${stderr}") + endif() message(SEND_ERROR "FAIL: Test output does not match the expected output; output stored in ${RANDOM_FILE}" ) else() file(REMOVE "${RANDOM_FILE}")